package com.uzai.console.web.alarm;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSort;
import com.uzai.console.annotation.SystemLogType;
import com.uzai.console.dto.alarm.alarmriskuser.AlarmRiskUserIdDto;
import com.uzai.console.dto.alarm.alarmriskuser.AlarmRiskUserQuery;
import com.uzai.console.dto.alarm.alarmriskuser.AlarmRiskUserStatusUpdateDto;
import com.uzai.console.dto.alarm.alarmrule.AlarmRuleInfoDto;
import com.uzai.console.enums.OperationTypeEnum;
import com.uzai.console.enums.SystemModelEnum;
import com.uzai.console.service.alarm.AlarmRiskUserService;
import com.uzai.console.vo.alarm.alramriskuser.AlarmRiskUserVo;
import com.uzai.console.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * 风险监控报警用户
 *
 * @author liuqi
 * @date 2021年08月16日 15:11
 */
@Api(value = "报警用户", tags = "云监控|风险监控|报警用户")
@ApiSort(19)
@RestController
public class AlarmRiskUserController extends BaseController {
    private Logger logger = LoggerFactory.getLogger(AlarmRiskUserController.class);

    @Autowired
    private AlarmRiskUserService alarmRiskUserService;

    @ApiOperation(value = "分页查询风险监控报警用户列表", notes = "分页查询风险监控报警用户列表", response = AlarmRiskUserVo.class)
    @ApiOperationSupport(order = 1)
    @PostMapping("/alarmRiskUser/findByPage")
    public Object findAlarmRiskUserPage(@RequestBody AlarmRiskUserQuery alarmRiskUserQuery) {
        return alarmRiskUserService.findAlarmRiskUserByPage(alarmRiskUserQuery);
    }

    @ApiOperation(value = "查询风险监控报警用户详情", notes = "查询风险监控报警用户详情", response = AlarmRiskUserVo.class)
    @ApiOperationSupport(order = 2)
    @PostMapping("/alarmRiskUser/findById")
    public Object findAlarmRiskUser(@RequestBody AlarmRiskUserIdDto alarmRiskUserIdDto) {
        return alarmRiskUserService.findAlarmRiskUserById(alarmRiskUserIdDto);
    }

    @SystemLogType(model = SystemModelEnum.AlarmRiskUser, type = OperationTypeEnum.UPDATE)
    @ApiOperation(value = "修改风险监控报警用户状态", notes = "修改风险监控报警用户状态", response = Boolean.class)
    @ApiOperationSupport(order = 3)
    @PostMapping("/alarmRiskUser/updateStatus")
    public Object updateAlarmRiskUserStatus(@RequestBody AlarmRiskUserStatusUpdateDto alarmRiskUserStatusUpdateDto){
        alarmRiskUserService.updateAlarmRiskUserStatus(alarmRiskUserStatusUpdateDto);
        return true;
    }

}
